/*
 * @Descripttion: 
 * @version: 
 * @Author: 
 * @Date: 2022-04-24 08:59:45
 * @LastEditors: weidelong
 * @LastEditTime: 2022-05-07 17:17:40
 */
import { createApp } from 'vue'
import App from './App.vue'
import store from "./store"
import router from './router'
import axios from 'axios'
import VueAxios from 'vue-axios'
import {v4}  from 'uuid'
import VueSocketIO from 'vue-3-socket.io'
import io from 'socket.io-client'
import { 
    Button, 
    Icon, 
    Col, 
    Row, 
    Tabbar, 
    TabbarItem, 
    ShareSheet, 
    Swipe, 
    SwipeItem, 
    Cell, 
    CellGroup, 
    ActionSheet, 
    Image as VanImage, 
    Tab, 
    Tabs, 
    Form, 
    Field, 
    NavBar, 
    Uploader, 
    Search,
    Grid, 
    GridItem,
    List,
    PullRefresh,
	Toast,
	Calendar,
	Dialog,
	Popup,
	Divider,
    Overlay,
    ImagePreview,
    Empty,
    RadioGroup,
    Radio
} from 'vant'



const app = createApp(App)

app.config.globalProperties.$uid = v4

// const socketio = new VueSocketIO({
//     debug: true,
//     connection: "/api",
	// options: { autoConnect: false },
//     extraHeaders: {"Access-Control-Allow-Origin": '*'},
// })

// socket 连接参数
const socketOptions = {
    autoConnect: false,       // 自动连接     这里为我项目需求  需要在指定情况下才连接socket
    transports : ['websocket']
}
const socketio = new VueSocketIO({
    // debug: true,
    connection: io('http://localhost:3001', socketOptions),
    // connection: "http://localhost:3001",
    // options: { autoConnect: false, transports : ['websocket'] },
    extraHeaders: {"Access-Control-Allow-Origin": '*'},
})

app
    .use(store)
    .use(router)
    .use(VueAxios, axios)
    .use(Button)
    .use(Icon)
    .use(Col)
    .use(Row)
    .use(Tabbar)
    .use(TabbarItem)
    .use(ShareSheet)
    .use(Swipe)
    .use(SwipeItem)
    .use(Cell)
    .use(CellGroup) 
    .use(ActionSheet)
    .use(VanImage)
    .use(Tab)
    .use(Tabs)
    .use(Form)
    .use(Field)
    .use(NavBar)
    .use(Uploader)
    .use(Search)
    .use(Grid)
    .use(GridItem)
    .use(List)
    .use(PullRefresh)
	.use(Toast)
	.use(Calendar)
	.use(Dialog)
	.use(Popup)
	.use(Divider)
    .use(Overlay)
    .use(ImagePreview)
    .use(Empty)
    .use(RadioGroup)
    .use(Radio)
    .use(socketio)
.mount('#app')
